/*
 * @Author: ChunLai
 * @Date: 2022-06-15 15:03:30
 * @LastEditTime: 2024-03-07 15:38:54
 * @Description: 客户风险告知
 * @FilePath: \0.newInsure\src\store\modules\fengxian.js
 */

const state = {
  ccEstimateCriterion: [
    {
      label: "谨慎型",
      text: "您不适宜作为投保人直接购买保险产品，可能存在风险错配的情况，建议您咨询销售人员或保险专业人员，充分了解保险责任、责任免除、交费期限、犹豫期、退保费用等内容，确认保险产品是您所需要的。",
      min: 0,
      max: 50,
      value: "1",
    },
    {
      label: "稳健型",
      text: "您对保险有初步的了解，适合购买传统寿险、健康险、年金险等保障型或保单利益确定的保险产品。",
      min: 50,
      max: 70,
      minLevel: 4,
      value: "2",
    },
    {
      label: "平衡型",
      text: "您对保险有一定的了解，适合购买普通型产品、万能险、分红险、政策型产品等保单利益确定或风险较小的保险产品。",
      min: 70,
      max: 80,
      minLevel: 3,
      value: "3",
    },
    {
      label: "进取型",
      text: "您对保险有较深的了解，适合购买普通型产品、新型产品、变额年金险、政策型产品等保单利益确定的保险产品或中低风险类保险产品。",
      min: 80,
      max: 90,
      minLevel: 2,
      value: "4",
    },
    {
      label: "激进型",
      text: "您对保险有深入的了解，并具有较高的风险承受能力，适合购买普通型产品、新型产品、变额年金险、政策型产品等保单利益确定的保险产品或中低风险类保险产品，以及非保险类金融产品。",
      min: 90,
      max: 200,
      value: "5",
    },
  ],
  pointDesc: "",
  testResult: {},
};
const getters = {
  ccEstimateCriterion: (state) => state.ccEstimateCriterion,
  pointDesc: (state) => state.pointDesc,
  testResult: (state) => state.testResult,
};
const mutations = {
  SET_STATE_FIELD(state, payload) {
    Object.assign(state, payload);
  },
  SET_RES_OBJ(state, payload) {
    state.testResult = payload;
  },
  SET_POINT_VALUE(state, payload) {
    state.pointDesc = payload;
  },
};
const actions = {
  getResObj({ state, commit }, pointDesc = "") {
    if (pointDesc) {
      commit("SET_POINT_VALUE", pointDesc);
      let obj = state.ccEstimateCriterion.find((ele) => ele.value == pointDesc);
      if (obj) {
        commit("SET_RES_OBJ", obj);
      }
    }
  },
};

export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions,
};
